import { gql, useQuery } from "@apollo/client"
import { UserEntity, UserFields } from "../interfaces/UserEntity"


const viewerQuery = gql`
    query ViewerQuery{
        viewer{
            ${UserFields}
        }
    }
`
const useViewer = () => {
    const { data, error, loading } = useQuery<{
        viewer: UserEntity
    }>(viewerQuery)
    return { error, loading, data: data?.viewer }
}
export default useViewer